home *** CD-ROM | disk | FTP | other *** search
/ Personal Computer World 2008 May / PersonalComputerWorld-May2008-CoverdiscCD.iso / Software / Full / Nero 7 / Installation / Cab / 83AF5E4E.cab / Hilite58F430CD.js < prev    next >
Encoding:
JavaScript  |  2006-06-20  |  2.5 KB  |  65 lines

  1. /* Though the cursor is invisible until you move the mouse, extensibility pages get a mouseover event
  2. when they load. If your invisible cursor is over a focusable item, this mouseover event can cause the
  3. focus to land on the wrong item when the page loads. The bFirstMouseover variable (originally set in the
  4. MoveFocus.js file) is used to identify that initial mouseover event and nullify it. 
  5. The first mouseover event fires when the page loads. Then there is a statement in the 
  6. StartFocus function, in the MoveFocus.JS file, which uses the setTimeout method to wait until
  7. after that first mouseover event fires and then resets bFirstMouseover to false, so the subsequent 
  8. mouseovers will be handled normally */
  9.  
  10. function mouseOver(item)
  11. {
  12.     // if this is the first mouseover event that fires automatically when the page loads, return
  13.     if (bFirstMouseover == true) return
  14.  
  15.     // make sure item is focusable
  16.     if (event.srcElement.MCFocusable != "true" || event.srcElement.MCTempUnFocusable == "true") return
  17.     // update oCurFocus variable
  18.     oCurFocus = item
  19.     // since user used mouse instead of an arrow key, reset sPrevArrowDirection variable to null
  20.     sPrevArrowDirection = null
  21.     // move focus to new item
  22.     item.focus()
  23. }
  24.  
  25. function hilite(item)
  26. {
  27.     // if item is not focusable, return
  28.     if (event.srcElement.MCFocusable != "true") return
  29.  
  30.     var sClass = item.className
  31.     //check if class name already ends in "_hilite" -- if so, quit function
  32.     if (checkSubstring(sClass) == true) return
  33.     // change element's class name for highlighting
  34.    item.className = sClass + "_hilite"
  35.     try
  36.     {
  37.             /*as needed, update the numeric value for the item counter found at the lower right of
  38.             each scrollable menu in the templates */
  39.            updateCounter()
  40.     }
  41.     catch(e)
  42.     {
  43.         //ignore error
  44.     }
  45. }
  46.  
  47. function restore(item)
  48. {
  49.     //if (event.srcElement.MCFocusable != "true") return
  50.     var sClass = item.className
  51.     //check if class name ends in "_hilite" -- if not, quit function
  52.     if (checkSubstring(sClass) == false) return
  53.     // remove "_hilite" (last 8 characters) from class name to return to unhighlighted state
  54.    item.className = sClass.substring(0,(sClass.length -7))
  55. }
  56.  
  57. function checkSubstring(sClass)
  58. {
  59.     // this function checks whether a class name ends in "_hilite"
  60.     if (sClass.substring((sClass.length -7), sClass.length) == "_hilite")
  61.     {
  62.         return true
  63.     }
  64.     return false
  65. }